<?php include_once ('../global.php');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<link href="<?php echo CSS_PATH?>main.css" rel="stylesheet" type="text/css">
<link href="<?php echo CSS_PATH?>style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<?php echo JS_PATH?>jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH?>main.js"></script>
<script src="<?php echo JS_PATH?>h.js" type="text/javascript"></script>
<title><?php echo $match_cn_name?>-成绩直播</title>
<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js "></script>
 
<script>
    var  url=location.href;
	var wxdata;
		//alert(url.split("&")[0]);
		console.log(url.replace(/\&/g,"%26").replace(/\#/g,"%23"));
    $.ajax({
        type : "get",
        url : "http://live.scoringchina.com/scoringchina/wx/weixin_token/jssdk.php?url="+ url.replace(/\&/g,"%26").replace(/\#/g,"%23"),
        dataType : "jsonp",
        jsonp: "callback",
        jsonpCallback:"success_jsonpCallback",
        success : function(data){
			console.log(data);
			wxdata = data;
            wx.config({
                debug: false,
                appId: data.appId,
                timestamp: data.timestamp,
                nonceStr: data.nonceStr,
                signature: data.signature,
                jsApiList: [
                    'onMenuShareTimeline',//
                    'onMenuShareAppMessage',
                    'onMenuShareQQ',
                    'onMenuShareWeibo',
                    'onMenuShareQZone'
 
                ]
            });
			console.log(wxdata);
        },
        error:function(data){
           // alert("连接失败！");
        }
    });
 
    wx.ready(function () {
        var shareData = {
            title: '<?php echo $match_cn_name?>-成绩直播-by 斯科云科技Scoringchina',
            desc: '<?php echo $match_cn_name?>-成绩直播-by 斯科云科技Scoringchina',
            link: url,
            imgUrl: 'http://live.scoringchina.com/scoringchina/volvochinaopen/mobile/images/volvo_logo.png'
        };
		//alert(wxdata.url);
		//alert(url);
        wx.onMenuShareAppMessage(shareData);//分享给好友
        wx.onMenuShareTimeline(shareData);//分享到朋友圈
        wx.onMenuShareQQ(shareData);//分享给手机QQ
        wx.onMenuShareWeibo(shareData);//分享腾讯微博
        wx.onMenuShareQZone(shareData);//分享到QQ空间
 
 
 
    });
    wx.error(function (res) {
		console.log(res);
       //  alert(res.errMsg);//错误提示
 
    });
</script>
<style>
	#content_score {
		min-height: 360px;
		padding: 96px 0 40px;
	}
	.radius_fillet3 {
		border-radius: 3px;
	}

	.tt_bar {
		height: 30px;
		border-bottom: 1px solid #e3e3e3;
	}
	.score_title2 {
		height: 30px;
		border-bottom: 1px solid #e3e3e3;
		text-indent: 14px;
	}
	.score_back {
		text-align: right;
		padding-right: 14px;
	}
	.bt_back {
		display: inline-block;
		width: 40px;
		height: 18px;
		line-height: 18px;
		cursor: pointer;
		border: 1px solid #363636;
		color: #363636;
		font-size: 12px;
		text-align: center;
	}
	.score_tround {
		height: 30px;
		line-height: 30px;
	}
	.score_tround span {
		color: #363636;
		float: right;
		font-size: 18px;
		height: 26px;
		line-height: 32px;
		margin-right: 15px;
		text-align: center;
		width: 50px;
	}
	.index_news {
		padding: 0 15px;
	}
	#playoff{
		margin:15px;
		border:solid 1px #a9c6c9;
	}
	
	.SAME{
		background-color:#C60;
		color:white;
		font-size:10px;
		padding:3px;
	}
	
	.WNR{
		background-color:#6C3;
		color:white;
		font-size:10px;
		padding:3px;
	}
	
	.ELM{
		background-color:#C30;
		color:white;
		font-size:10px;
		padding:3px;
	}
	.country{
		color:#ef7ca3;
		}
	.playofftitle{
		background-color:white;
		color:#666;
		font-weight:bold;
		height:30px;
		font-size:15px;
	}
	.playoffhole{
		background-color:#F0F0F0;
		height:30px;
		color:#666;
		font-weight:bold;
		
		}
	.playoffplayer{
		border-bottom:solid 1px #FFF;
		height:30px;
	}
</style>
<!--header-->
<style>
	#navi_wait {
		height: 35px;
		background-color: #E3E3E3;
	}

	#navi_wait ul li {
		width: 32%;
		display: inline;
		float: left;
		/*line-height:33px;*/

		line-height: 36px;
		list-style-position: inside;
		border-bottom: 1px solid #A5A5A5;
		text-align: center;
	}

	#navi_wait ul li a {
		color: #767676;
		font-size: 19px;
		letter-spacing: 5px;
	}
</style></head>
<div style="display:none;"><img src="./images/icon.png" alt=""></div>
<body id="body">

	<div id="sta">
		<table width="100%" border="0" cellpadding="0" celspacing="0">
			<tbody>
				<tr>
					<td style="text-align:center;"><img src="./images/3.png" style="width:350px;height:80px" /></td>
				</tr>
			</tbody>
		</table>
	</div>


	<div id="content_score" style="">
		<div class="button_areaindex" id="button_areaindex">  
			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tbody>
					<tr>
						<td class="score_title2">
							<select class="sear_right" onchange="window.open(this.options[this.selectedIndex].value,'_self')" data-role="none">
								<option value="">2020</option>
							</select>
						</td>
						<td class="score_back">
							<select >
								<option ><?php echo $match_cn_name?> </option>
								
							</select>
						</td>
					</tr>
				</tbody>
			</table>
		</div>

		<div class="clear_h10" style="clear:both; height:10px;"></div>
		<div id="con1" class="index_news">
			<div id="allstars">
			<table class="altrowstable">
				<tr>
					<th colspan="8" style="background:#FFFFFF; text-align:left;">
						<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:none;">
							<tbody>
								<tr>
									<td style="border:none; vertical-align:middle;">		
										<a href="group.php?mt_id=<?php echo $mt_id?>" style="float:right; padding-right:20px;margin-top:3px;">分组表</a>
									</td>
								</tr>
							</tbody>
						</table>
					</th>
				</tr>
				
				<tbody id="asman">
				<tr>
					<th width="15%" style="background-color:#203466;color:#fff">#</th>
					<th width="30%" style="background-color:#203466;color:#fff">Players</th>
					<?php
					for($i=1;$i<=$maxRound;$i++){
                    	echo '<th width="15%" style="background-color:#203466;color:#fff">R'.$i.'</th>';
                    }	
					?>		
					<th   style="background-color:#203466;color:#fff">Score</th>
					<th  style="background-color:#203466;color:#fff">After</th>
				</tr>
<?php
function toparcolor_mobile($score){
	if (!empty($score)){
		if ($score<='-2'){
            $color = 'mtwo';
        } else if ($score=='-1'){
            $color = 'mone';
        } else if ($score=='0'){
            $color = 'eng';
        } else if ($score=='1'){
            $color = 'pone';
        } else if ($score>='2'){
            $color = 'ptwo';
        } else {
            $color = 'eng';
        }
	} else {
		$color = 'eng';
	}
	return $color;
}



$holeScore   = getHoleScore($mt_id,$rd_id);        //当前洞和当前轮的topar
$score       = getScore($mt_id);                   //比赛成绩读取
for ($r=1;$r<=$rd_id;$r++){
    if (!empty($score['to_par'])){
        foreach ($score['to_par'] as $k => $v){
            $topar[$k] += $v[$r];
        }
    }
}
$summary_648 = playerSummary($mt_id,$rd_id);       //当前轮
$rank_648 = $summary_648['rank'];
$k=1;
$b=1;
if ($rank_648){
	foreach ($rank_648 as $i => $n){
		echo '<tr '.(($k%2==0)?'class="oddrowcolor"':'').'>
				<td width="15%">'.((empty($n))?'-':$n).'</td>
				<td align="left" style="text-align:left;" width="30%">
					<a href="detail.php?mt_id='.$mt_id.'&pl_id='.$i.'"><span style="color:#203466;">'.$players['playerCountry'][$i].'</span>&nbsp;&nbsp;'.$players['playerName'][$i].'&nbsp;&nbsp;'.$players['playerEnName'][$i].(($players['playerType'][$i]=='AMA')?'(A)':'').'</a>'.(($players['playerSex'][$i] == 0)?'&nbsp;<img src="./images/lady.png" width="10" height="10" style="padding-top:5px;padding-left:5px;" >':'').'
				</td>';
		for($r=1;$r<=$maxRound;$r++){
			echo '<td '.(($r>1)?'width="10%"':'').'>'.(($score['rd_score'][$i][$r])?$score['rd_score'][$i][$r]:'-').'</td>';
		}
		echo '<td width="15%" ><span '.(($topar[$i]<0)?'style="color:#e50049;"':'').'>'.(($topar[$i]=='0') ? 'E' : (($topar[$i]=='') ? '' : (($topar[$i]>0) ? '+'.$topar[$i] : $topar[$i]))).'</span></td>';
		if ($holeScore['thru'][$i]=='18'){
			if ($summary['checked'][$i]=='C'){
				echo '<td> F </td>';
			} else {
				echo '<td> F </td>';
			}
		} else {
			if ($holeScore['thru'][$i]!=""){
				echo '<td>'.$holeScore['thru'][$i].'</td>';
			} else {
			  echo '<td>-</td>';
			}
		}
		echo '</tr>';
		if ($k%10==0){
			if($b == 1){
				echo '<tr class="oddrowcolor"><td colspan="8" style="text-align:center;background-color:#fff;"><img src="./images/1.png" style="width:350px;height:80px"></td></tr>';
			}
			
            echo '<tr>
                    <th width="15%" style="background-color:#203466;color:#fff">#</th>
                    <th width="30%" style="background-color:#203466;color:#fff">Players</th>';
            for($i=1;$i<=$maxRound;$i++){
            	echo '<th width="15%" style="background-color:#203466;color:#fff">R'.$i.'</th>';
            }
            echo '<th style="background-color:#203466;color:#fff">Score</th>
                    <th style="background-color:#203466;color:#fff">After</th>
                </tr>';
				$b++;
		}	
		$k++;
	}
}
?>				
				
				</tbody>
			</table>
			</div>
		</div>


		<div id="con2" class="index_news" style="display: none;">
			<div id="as_con"></div>
			<div class="score_round">
				<?php
				for($i=$maxRound;$i>=1;$i--){
                	echo '<span class="jq_rclk" '.(($i==$rd_id)?'style="background-color:yellow"':'').'><a href="?mt_id='.$mt_id.'&rd_id='.$i.'">R'.$i.'</a></span>';
                }	
				?>
				<input type="hidden" id="round_num" name="round_num" value="" data-role="none">
			</div>


			<table class="altrowstable" id="k_as_man">
				<tbody>
					<tr>
						<th width="2%" rowspan="2" style="background-color:#203466;color:#fff"> Pos </th>
						<th width="15%" rowspan="2" style="background-color:#203466;color:#fff"> Players </th>
						<th width="3%" rowspan="2" style="background-color:#203466;color:#fff"> After </th>
						<th width="2%" rowspan="2" style="background-color:#203466;color:#fff"> TP </th>
						<th width="2%" rowspan="2" style="background-color:#203466;color:#fff"> TD </th>
						<th width="3%" style="background-color:#203466;color:#fff">1</th>
						<th width="3%" style="background-color:#203466;color:#fff">2</th>
						<th width="3%" style="background-color:#203466;color:#fff">3</th>
						<th width="3%" style="background-color:#203466;color:#fff">4</th>
						<th width="3%" style="background-color:#203466;color:#fff">5</th>
						<th width="3%" style="background-color:#203466;color:#fff">6</th>
						<th width="3%" style="background-color:#203466;color:#fff">7</th>
						<th width="3%" style="background-color:#203466;color:#fff">8</th>
						<th width="3%" style="background-color:#203466;color:#fff">9</th>
						<th width="3%" style="background-color:#203466;color:#fff">OUT</th>
						<th width="3%" style="background-color:#203466;color:#fff">10</th>
						<th width="3%" style="background-color:#203466;color:#fff">11</th>
						<th width="3%" style="background-color:#203466;color:#fff">12</th>
						<th width="3%" style="background-color:#203466;color:#fff">13</th>
						<th width="3%" style="background-color:#203466;color:#fff">14</th>
						<th width="3%" style="background-color:#203466;color:#fff">15</th>
						<th width="3%" style="background-color:#203466;color:#fff">16</th>
						<th width="3%" style="background-color:#203466;color:#fff">17</th>
						<th width="3%" style="background-color:#203466;color:#fff">18</th>
						<th width="3%" style="background-color:#203466;color:#fff">IN</th>
						<?php
						for($i=1;$i<=$maxRound;$i++){
							echo '<th width="3%" rowspan="2" style="background-color:#203466;color:#fff">R'.$i.'</th>';
						}
						?>
						<th width="3%" rowspan="2" style="background-color:#203466;color:#fff"> Total </th>
					</tr>
					<tr>
						<?php
                            $out_total = $in_total = 0;
                            for ($i=1;$i<10;$i++){
                                echo '<th class="clspar" style="background-color:#203466;color:#fff">'.$pars["par"][($i-1)].'</th>';
                                $out_total += $pars["par"][($i-1)];
                            }
                            echo '<th class="clspar" style="background-color:#203466;color:#fff">'.$out_total.'</th>';

                            for ($i=10;$i<19;$i++){
                                echo '<th class="clspar" style="background-color:#203466;color:#fff">'.$pars["par"][($i-1)].'</th>';
                                $in_total += $pars["par"][($i-1)];
                            }
                            echo '<th class="clspar" style="background-color:#203466;color:#fff">'.$in_total.'</th>';
                        ?>
					</tr>
<?php
$k=1;
foreach ($rank_648 as $i => $n){
	echo '<tr '.(($k%2==0)?'class="oddrowcolor"':'').'>
			<td>'.((empty($n))?'-':$n).'</td>
			<td style="text-align:left;"><span style="color:#203466;">'.$players['playerCountry'][$i].'</span>&nbsp;&nbsp;'.$players['playerName'][$i].'&nbsp;&nbsp;'.$players['playerEnName'][$i].(($players['playerType'][$i]=='AMA')?'(A)':'').(($players['playerSex'][$i] == 0)?'&nbsp;<img src="./images/lady.png" width="10" height="10" style="padding-top:5px;padding-left:5px;" >':'').'</td>';
	//完成洞数
    if ($holeScore['thru'][$i]=='18'){
        if ($summary_648['checked'][$i]=='C'){
            echo '<td> F </td>';
        } else {
            echo '<td> F </td>';
        }
    } else {
        if ($holeScore['thru'][$i]!=""){
            echo '<td>'.$holeScore['thru'][$i].'</td>';
        } else {
          echo '<td></td>';
        }
    }
    echo '<td '.(($topar[$i]<0)?'style="color:#e50049;"':'').'>'.(($topar[$i]=='0') ? 'E' : (($topar[$i]=='') ? '' : (($topar[$i]>0) ? '+'.$topar[$i] : $topar[$i]))).'</td>
		  <td '.(($score['to_par'][$i][$rd_id]<0)?'style="color:#e50049;"':'').'>'.(($score['to_par'][$i][$rd_id]=='0') ? 'E' : (($score['to_par'][$i][$rd_id]=='') ? '' : (($score['to_par'][$i][$rd_id]>0) ? '+'.$score['to_par'][$i][$rd_id] : $score['to_par'][$i][$rd_id]))).'</td>';
	//18洞成绩
    $out_score = $in_score = 0;
    for ($h=1;$h<10;$h++){
        echo '<td class="'.toparcolor_mobile($holeScore['topar'][$i][$h]).'">'.$holeScore['score'][$i][$h].'</td>';
        $out_score += $holeScore['score'][$i][$h];
    }
    echo '<td class="inout">'.$out_score.'</td>';
    for ($h=10;$h<19;$h++){
        echo '<td class="'.toparcolor_mobile($holeScore['topar'][$i][$h]).'">'.$holeScore['score'][$i][$h].'</td>';
        $in_score += $holeScore['score'][$i][$h];
    }
    echo '<td class="inout">'.$in_score.'</td>';

    //R1-R4成绩
    $totalscore = '';
    for($r=1;$r<=$maxRound;$r++){
        if ($r<=$rd_id){
            echo '<td class="rtotal">'.$score['rd_score'][$i][$r].'</td>';
            $totalscore += $score['rd_score'][$i][$r];
        } else {
            echo '<td class="rtotal">-</td>';
        }
    }
    echo '<td class="inout">'.$totalscore.'</td>';
	echo '</tr>';
	$k++;
}
?>
				<tr class="oddrowcolor"><td colspan="30" style="text-align:center;background-color:white;"><img src="./images/1.png" style="width:350px;height:80px"></td></tr>
				</tbody>
			</table>


			
			
			


		



		</div>
	</div>
	<div style="background-color:#fffff;text-align:centre;display:flex;justify-content: center;">
			<img src="./images/ad.jpg" style="width:100%;height:100%"></div>
	</div>
<div id="bottom">
	<div id="bootom-top">
        <span style="width:100%;text-align:center">技术支持  @斯科云科技</span>
        <script type="text/javascript">document.write(unescape("%3Cspan id='cnzz_stat_icon_1279000992'%3E%3C/span%3E%3Cscript src='https://s4.cnzz.com/z_stat.php%3Fid%3D1279000992%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));</script>
		<a href="#body" target="_self">回顶部</a>
	</div>
</div>
</body>
</html>